From 4b1b4e1c554d09893916c61ee91f26e8a77f5335 Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.me>
Date: Sun, 29 Oct 2023 22:18:39 -0700
Subject: feat(badges): switch to http get

---
 src/routes/user/[user]/badges/+page.svelte | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

(limited to 'src/routes/user/[user]/badges/+page.svelte')

diff --git a/src/routes/user/[user]/badges/+page.svelte b/src/routes/user/[user]/badges/+page.svelte
index dbf8d21c..649b0de7 100644
--- a/src/routes/user/[user]/badges/+page.svelte
+++ b/src/routes/user/[user]/badges/+page.svelte
@@ -1,26 +1,27 @@
 <script lang="ts">
 	import { userIdentity } from '$lib/AniList/identity.js';
+	import { user } from '$lib/AniList/user.js';
 	import type { Badge } from '$lib/userBadgesDatabase.js';
 	import { onMount } from 'svelte';
-	import { io } from 'socket.io-client';
+	// import { io } from 'socket.io-client';
 
 	export let data;
 
 	let editMode = false;
 	let currentUserIdentity: ReturnType<typeof userIdentity>;
 	let error: null | string;
-	const socket = io();
+	// const socket = io();
 	let badges: Badge[] | null = null;
 
 	onMount(async () => {
-		socket.on('badges', (message) => {
-			badges = message;
-		});
+		// socket.on('badges', (message) => (badges = message));
+
+		badges = await (await fetch(`/api/badges/get?id=${(await user(data.username)).id}`)).json();
 
 		if (data.user) {
 			currentUserIdentity = userIdentity(data.user);
 
-			socket.emit('badges', data.user);
+			// socket.emit('badges', data.user);
 		} else {
 			currentUserIdentity = new Promise((resolve) =>
 				resolve({
-- 
cgit v1.2.3

